<?php
$cid        = gpc_getStringArray('cid');
$name       = "";

if(count($cid)==0)
{
    $cid[0]=$id;
}

foreach($cid as $id)
{

    //---------------Lay thong tin ve location sap xoa
    $sql_select = "SELECT cType,iParentId FROM tblpromotions WHERE iId = '$id'";
    $rs=$dbsql->query($sql_select);
    if($result = $dbsql->fetch_array($rs))
    {
    	$type           = $result["cType"];
        $idparent       = $result['iParentId'];
    
        $sql_delete = "DELETE FROM tblpromotions WHERE iId ='$id'";
        $dbsql->query($sql_delete);
        
        $sql_update = "update ";
        $sql_update.= ($type=='tour')? 'tblsettour': 'tblhotel';
        $sql_update.= " set iPromotion=0 where iId='$idparent'";
        $dbsql->query($sql_update);
    }
}

page_transfer("Delete promotions Success",$pagetr);
exit();
?>